home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
021-030
/
amok28
/
patchmrg
/
createport.i
next >
Wrap
Text File
|
1993-11-04
|
2KB
|
95 lines
; macros execsupport May 89
; © Bernd Preusing, Gerhardstr. 16, D-2200 Elmshorn
include exec/exec.i
IFND _LVOPermit
include exec/exec_lib.i
ENDC
CALLSYS MACRO ; läßt A6
jsr _LVO\1(A6)
ENDM
CreatePort MACRO ; name, prio
IIF NARG-2 fail
lea.l \1,a0
move.b \2,d0
bsr CreaPort
IFND CreatePortIs
CreatePortIs SET 1
bra.s cp\@
CreaPort
movem.l d2-d3/a2-a3/A6,-(A7)
move.l a0,a2
move.b d0,d2
moveq #0,d0
move.l d0,a3
moveq #-1,d0
CALLEXEC AllocSignal
move.l d0,d3
bmi.s cp_nosig
moveq #MP_SIZE,d0
move.l #MEMF_PUBLIC|MEMF_CLEAR,d1
CALLSYS AllocMem
move.l d0,a3
tst.l d0
bne.s cp_memok
move.l d3,d0
CALLSYS FreeSignal
bra.s cp_ret
cp_memok:
move.l a2,LN_NAME(a3)
move.b d2,LN_PRI(a3)
move.b #NT_MSGPORT,LN_TYPE(a3)
move.b #PA_SIGNAL,MP_FLAGS(a3)
move.b d3,MP_SIGBIT(a3)
movea.w #0,a1
CALLSYS FindTask
move.l d0,MP_SIGTASK(a3)
move.l a2,d0
beq.s cp_noname
move.l a3,a1
CALLSYS AddPort
bra.s cp_ret
cp_noname:
lea.l MP_MSGLIST(a3),a0
NEWLIST A0
cp_nosig:
cp_ret:
move.l a3,d0
movem.l (a7)+,d2-d3/a2-a3/A6
rts
cp\@
ENDC
ENDM
DeletePort MACRO ; port
IIF NARG-1 FAIL
move.l \1,a1
bsr DelPort
IFND DeletePortIs
DeletePortIs SET 1
bra.s dp\@
DelPort:
movem.l a2/a6,-(a7)
move.l a1,a2
tst.l LN_NAME(a2)
beq.s dp_noname
CALLEXEC RemPort
dp_noname:
moveq #-1,d0
move.b d0,LN_TYPE(a2)
move.l d0,MP_MSGLIST(a2)
moveq #0,d0
move.b MP_SIGBIT(a2),d0
CALLEXEC FreeSignal
move.l a2,a1
moveq #MP_SIZE,d0
CALLSYS FreeMem
movem.l (a7)+,a2/a6
rts
dp\@
ENDC
ENDM